<?php
/**
 * ws服务api接口无权限验证、无登录验证公共基础类
 * User: raisound
 * Date: 2021/10/13
 */

namespace app\ws\controller;
use app\BaseController;
use think\exception\HttpResponseException;

class Base extends BaseController
{
    public function initialize()
    {
        header('Access-Control-Allow-Origin: *');
        header('Access-Control-Allow-Headers: X-Token,Content-Type, Content-Length, Authorization, Accept, X-Requested-With, Current-Page');
        header('Access-Control-Allow-Methods: POST,GET,OPTIONS,DELETE,PUT');
        parent::initialize();
    }

    public function returnResult(...$args){
        try{
            throw new HttpResponseException(returnResultExit(...$args));
        }catch (\Exception $e){
            logWrite('Base,returnResult', $e->getMessage(),__FILE__ );
        }
    }

}
